package com.softeem.service;

import cn.hutool.core.util.StrUtil;
import com.softeem.mapper.BookMapper;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;

import javax.annotation.Resource;

@Service
public class BookService {
    // int updateBook(@Param("title") String title,@Param("id") int id);
    @Resource
    public BookMapper bookMapper;

    @Transactional(rollbackFor = RuntimeException.class)
    public int updateBook(String title,int id){
       if(StrUtil.isBlank(title) || StrUtil.isBlank(new Integer(id).toString())){
           throw new RuntimeException("不可为空");
       }
     return   bookMapper.updateBook(title,id);
    }

}
